<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
 
<%@ include file="/header.jsp" %>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <title>My JSP 'dbc.jsp' starting page</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->

  </head>
  <body>登录名：${loginUser.username} 
 		<form method="post" action="${ctx}/user/manager?func=update" onsubmit="return validate(this)">
		<input type="hidden" name="id" value="${loginUser.id}"/>
			用户名:<input type="text" name="username" value="${loginUser.username}" readonly/><br>
			原密码:<input type="password" name="opassword"/><br>
			新密码:<input type="password" name="password"/><br>
			确认密码:<input type="password" name="rpassword"/><br>
			<input type="submit" name="submit" value="确定"/>
		</form>
		${message}
  </body>

<script type="text/javascript">
 function validate(f){
    if(f.opassword.value.length==0){
      alert("请输入原密码！");
      f.opassword.focus();
      return false;
     }
    if(f.opassword.value!="${loginUser.password}"){
      alert("原密码不正确！");
      f.opassword.focus();
      return false;
     }
    if(f.password.value.length<4){
      alert("新密码长度必须4以上！");
      f.password.focus();
      return false;
     }   
    if(f.password.value!=f.rpassword.value){
      alert("新密码和确认密码不一致！");
      f.password.focus();
      return false;
     }    }
</script>

</html>

